/*
 * Platzad
 * Copyright 2008 Shayne Riley
 *
 * This file is part of Platzad.
 *
 * Platzad is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Platzad is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Platzad.  If not, see <http://www.gnu.org/licenses/>.
 *
 * To contact the authors on questions or issues regarding the license,
 * you may send an email to <shayner at gmail dot com> or write to
 * Shayne Riley / P.O. Box 1092 / McCook, NE 69001.
 */

#ifndef GRAPHICS_H_
#define GRAPHICS_H_

#include <SDL/SDL.h>
//#include <GL/gl.h>
//#include <GL/glu.h>
#include "ImageSDL.h"

namespace pzdDisplay
{

//! Interface to graphics functionality.
/**
 * Instead of using whatever graphics library directly, having all of their
 * raw functionality exposed, we will instead provide this interface, which
 * all concrete classes must implement.
 *
 * This will ensure that the display sub-system remains as platform independent
 * as possible. It can also allow for the possibility to change to different
 * implementations (SDL, OpenGL, DirectX, etc.) _during runtime_, if this is
 * handled in a correct manner.
 */
class Graphics
{
public:
	static Graphics& getInstance();

    void renderScene();

    //! Attempts to draw the given image to the back buffer.
    /**
     * The effects of this opperation usually won't be immediate. After all the
     * images have been drawn, renderScene should be called to show the results
     * to the user of the program.
     *
     * @param image	The image to draw. Should not be NULL, because no checks
     * 	are performed.
     * @param x	The upper-left horizontal position to begin the image.
     * @param y	The upper-left vertical position to be begin the image.
     * @param w	The width to stretch the image.
     * @param h	The height to stretch the image.
     */
    void drawImage(const ImageSDL * const image, int x, int y, int w, int h);

    //! Attempts to draw the given image to the back buffer.
    /**
     * The effects of this opperation usually won't be immediate. After all the
     * images have been drawn, renderScene should be called to show the results
     * to the user of the program.
     *
     * @param image	The image to draw. Should not be NULL, because no checks
     * 	are performed.
     * @param x	The upper-left horizontal position to begin the image.
     * @param y	The upper-left vertical position to be begin the image.
     */
    void drawImage(const ImageSDL * const image, int x, int y);

private:
	//! Constructor for the display utilities.
	/**
	 * This is private for the moment because it looks to be a singleton.
	 * However I am unsure how to handle this in a derived implementation.
	 */
    Graphics();

    //! Destructor which should only be called at the finish of the program.
    ~Graphics();

    //! Initializes the low-level graphics information. Should only be called
    //! from a constructor.
    void init();

    //! No copying needed, do not allow. Copy ctor declared, not defined.
    Graphics(const Graphics& rhs);
    //! No assignment needed. Do not define this function.
    Graphics& operator=(const Graphics rhs);
    //! No address-of needed. Do not define this function.
    Graphics* operator&();
    //! No const address-of needed. Do not define this function.
    const Graphics* operator&() const;
};

} // namespace

#endif /*GRAPHICS_H_*/
